
/*
JETware Hands-free Extension provides additional features for Windows Mobile HFP support.
Copyright (C) 2004-2009 Jim Thatcher

This program is free software; you can redistribute it and/or modify it under the terms of the 
GNU General Public License as published by the Free Software Foundation; version 2 of the License.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; 
without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 
See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; 
if not, write to the Free Software Foundation, Inc., 
59 Temple Place, Suite 330, Boston, MA 02111-1307 USA

Source Control header

$Workfile: JetBTConfig.cpp $
$Revision: 1 $
$Date: 1/1/09 1:11p $
*/
#if !defined(AFX_JETBTCONFIG_H__E48985A6_E8C9_44EB_A77A_11CA3E0BCE90__INCLUDED_)
#define AFX_JETBTCONFIG_H__E48985A6_E8C9_44EB_A77A_11CA3E0BCE90__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "windows.h"
#include "resource.h"
#include <pimstore.h>
#include <objbase.h>
#include <tpcshell.h>
#include <htmlctrl.h>
#include <bthutil.h>
#include <mapidefs.h>
#include <mapicode.h>
#include <mapitags.h>
#include <mapix.h>
#include <mapiutil.h>

#define MENU_HEIGHT 26
#define IDM_REFRESH 40007

#define SLA_FULL			42
#define SLA_NEED_REBOOT		8

#define CMD_INTERNAL_ONLY	0
#define CMD_LOCAL_ONLY		1
#define CMD_BOTH			2
#define RK_AUDIO_GATEWAY            _T("SOFTWARE\\Microsoft\\Bluetooth\\AudioGateway")
#define RK_AUDIO_GATEWAY_DEVICES    (RK_AUDIO_GATEWAY TEXT("\\Devices"))
#define RK_AG_SERVICE   _T("Services\\BTAGSVC")
#define JETWARE_KEY		_T("SOFTWARE\\JETware\\AGext")
#define JETWARE_MS		_T("SOFTWARE\\JETware\\AGext\\Messaging")
#define MSG_MAX			_T("MsgMax")
#define ALL_MSGS		_T("AllMsgs")
#define ONLY_NEW		_T("OnlyNew")
#define NOTIFY			_T("Notify")

#define FEATUREMASK _T("FM")
#define CHAINMODULE _T("BTAGExtChain")
#define PBMODULE	_T("BTAGPBModule")
#define EXTMODULE _T("BTAGExtModule")
#define PBFILTER _T("ContactFilter")
#define INCLUDE_NOCAT	_T("IncludeNoCat")
#define PBLIMIT_ME _T("ContactLimit")
#define PBLIMIT_SM _T("SimContactLimit")
#define PBLIMIT_DC _T("DialedContactLimit")
#define PBLIMIT_RC _T("IncomingContactLimit")
#define PBLIMIT_MC _T("MissedContactLimit")
#define PBINCLUDE_FAX _T("IncludeFaxNumbers")
#define INVERTROAM _T("InvertRoam")
#define STATUSPOLL_INCALL _T("InCallInterval")
#define STATUSPOLL_IDLE _T("IdleInterval")
#define REPORT_IMI _T("ReportIMI")
#define MFR_STRING _T("MfrString")
#define MODEL_STRING _T("ModelString")
#define SM_MSG_STORE	_T("SMMsgStore")
#define SM_MSG_MAX		_T("SMMsgMax")
#define SM_ALL_MSGS		_T("SMAllMsgs")
#define ME_MSG_STORE	_T("MEMsgStore")
#define ME_MSG_MAX		_T("MEMsgMax")
#define ME_ALL_MSGS		_T("MEAllMsgs")
#define PHONE_ID _T("PhoneID")
#define HANDLE_CMER _T("CMER")
#define HANDLE_CIND _T("CIND")
#define HANDLE_CLIP _T("CLIP")
#define HANDLE_CHUP _T("CHUP")
#define HANDLE_CKPD _T("CKPD")
#define HANDLE_CPMS _T("CPMS")
#define HANDLE_CPBS _T("CPBS")
#define KEY_VALUE _T("Mode")
#define DEBUGLEVEL		_T("BTAGExtDebug")
#define TEST _T("Test")
#define POWER_REQ		_T("InSessionPower")
#define IN_BAND_RING	_T("InBandRingtone")
#define SLEEP_ON_DISCONNECT _T("SleepOnDisconnect")

#define CONTACTS_ME		0
#define CONTACTS_SM		1
#define CONTACTS_DC		2
#define CONTACTS_RC		3
#define CONTACTS_MC		4
#define NO_LIMIT		-1

#define MESSAGES_ME		0
#define MESSAGES_SM		1

extern WORD g_wDebugLevels;
extern TCHAR * g_szContactFilter;
extern BOOL  g_bIncludeNoCat;
extern DWORD g_dwIncludeFax;
extern DWORD g_dwMaxContacts[5];
extern DWORD g_dwInvertRoam;
extern DWORD g_dwInCallInterval;
extern DWORD g_dwIdleInterval;
extern DWORD g_dwReportIMI;
// Options to select built-in, local, or combined handling of certain commands and reporting
extern DWORD g_dwHandleCMER;
extern DWORD g_dwHandleCIND;
extern DWORD g_dwHandleCLIP;
extern DWORD g_dwHandleCHUP;
extern DWORD g_dwHandleCKPD;
extern DWORD g_dwHandleCPBS;
extern DWORD g_dwHandleCPMS;
extern DWORD g_dwFeatureMask;
extern DWORD g_dwInBandRing;
extern DWORD g_dwSleepOnDisconnect;

#define FEATURE_NO_CAT		0x00000001

extern TCHAR * g_szMfrString;
extern TCHAR * g_szModelString;

extern TCHAR g_szIMEI[32];
extern TCHAR g_szActCode[16];

extern TCHAR * g_szMsgStore[2];
extern DWORD g_dwMsgMax[2];
extern BOOL g_bAllMsgs[2];

extern TCHAR * g_szMsgStoreNew[2];
extern DWORD g_dwMsgMaxNew[2];
extern BOOL g_bAllMsgsNew[2];

extern TCHAR g_szDllPath[MAX_PATH];
extern TCHAR g_szModel[64];
extern TCHAR g_szMfr[64];
extern TCHAR g_szVersion[32];
extern TCHAR g_szHWID[32];

DWORD GetPhoneInfo();

void WriteCategories(TCHAR * szCatList);
void GetRegSettings();
void WriteActivationCode(DWORD dwActCode);
void WriteAdvancedSettings();
void WriteMessageSettings();
void WriteFeatureSettings();

BOOL IsSupported();
BOOL IsInstalled();
BOOL IsRegistered();
BOOL IsRunning();
BOOL Register();
BOOL RestartBAG();
BOOL RestartJPB();
void SetLogging(DWORD dwLogLevel);

// MessagesMAPI
DWORD InitializeMAPI(DWORD dwStore);
void CleanupMAPI();
// DWORD GetMapiMessageCount();
void ReadMessage(int nIndex);
void ReadMapiMessage(int nIndex);
void DeleteMapiMessage(int iIndex);

// DeviceSettings
BOOL AddDeviceSettings(HWND hWnd, TCHAR * szFilename);

// JetBTConfig.cpp
void ReadHardwareDeviceString(TCHAR * szDeviceString, WORD wFlags);
void DrawTitleHeader(HWND hDlg, LPDRAWITEMSTRUCT lpdis);
BOOL ScrollDialog(HWND hDlg, WPARAM wParam);
BOOL ResizeDialog(HWND hDlg, DWORD ctrlID, HWND hChild);
BOOL SetupScrollbar(HWND hDlg, DWORD ctrlID, DWORD dwMax);
BOOL ScrollToActiveControl(HWND hDlg, WPARAM wParam, WORD ctrlID, WORD offset);

#define HWINFO_MFR		0x0004
#define HWINFO_MODEL	0x0002
#define HWINFO_VER		0x0001
#define HWINFO_ALL_TAPI	0x0007
#define HWINFO_OEM		0x0008

BOOL InitializeOutlook();
extern IPOutlookApp * g_polApp;
extern IFolder * g_pContactsFolder;
extern int g_nNumContacts;
extern HINSTANCE g_hInst;  // Local copy of hInstance
extern TCHAR * szDeviceName;

// From PhonebookTransfer.cpp
void SendSelectedContacts(HWND hDlg);
extern DWORD	g_dwNumbersPerCard;
extern DWORD	g_dwNumbersPerContact;
extern DWORD	g_dwFNFormat;
extern DWORD	g_dwMaxNameLen;
extern DWORD	g_dwEncode;



#ifdef DEBUG
void LogBlob(void * pBlob, DWORD dwLen /*, DWORD wLevel */);
void LogString(LPSTR szCommand);
#endif

#endif // !defined(AFX_JETBTCONFIG_H__E48985A6_E8C9_44EB_A77A_11CA3E0BCE90__INCLUDED_)
